package com.ecommerce.onion.infrastracture.configuration;

import com.ecommerce.onion.DomainLayerApplication;
import com.ecommerce.onion.domain.repository.OrderRepository;
import com.ecommerce.onion.domain.service.DomainOrderService;
import com.ecommerce.onion.domain.service.OrderService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
 * @packageName: infrastracture.configuration（基础设施.配置）
 * @className: BeanConfiguration(bean配置)
 * @description: 服务配置
 * @author: luds
 * @version: v1.0
 * @date: 2021-03/25
 */
@Configuration
@ComponentScan(basePackageClasses = DomainLayerApplication.class)
public class BeanConfiguration {

	/**
	 * 由订单资料库装配订单服务
	 * @param orderRepository 订单资料库
	 * @return 返回订单服务
	 */
	@Bean
	OrderService orderService(final OrderRepository orderRepository) {
		return new DomainOrderService(orderRepository);
	}
}
